import { Entity, PrimaryGeneratedColumn, Column, Index } from "typeorm";
import { ManualTimestamp } from "../decorators/manual-timestamp.decorator";

@Entity("character_heal_claim")
@ManualTimestamp()
@Index(["characterId", "claimDate"], { unique: true })
export class CharacterHealClaimEntity {
  @PrimaryGeneratedColumn()
  id!: number;

  @Column("int", { name: "characterId" })
  characterId!: number;

  @Column("varchar", { length: 10, comment: "YYYY-MM-DD" })
  claimDate!: string;

  @Column("int", { default: 0, comment: "当日已使用次数" })
  usedCount!: number;

  @Column("datetime", { name: "created_at" })
  created_at!: Date;

  @Column("datetime", { name: "updated_at", nullable: true })
  updated_at!: Date | null;
}
